<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>组件的使用</title>
</head>
<body>

  <div id="root">
    <hello-world></hello-world>
    <world></world>
  </div>

  <div id="app">
    <h1>另外的模板</h1>
    <hello-world></hello-world>
    <world></world>
  </div>

  <script src="./libs/vue.js"></script>
  <script>
    // 组件配置选项
    const componentOptions = {
      template: `<h1>Hello</h1>`
    }
    // 注册全局组件
    Vue.component('HelloWorld', componentOptions)

    // 
    const localComponentOptions = {
      template: '<h1>world</h1>'
    }

    new Vue({
      el: '#root',
      data: {},
      components: {
        'world': localComponentOptions
      }
    })

    new Vue({
      el: '#app'
    })
  </script>
</body>
</html>